from python import Python
# from libs import work_with_unique_ptrs
from .ptr import work_with_unique_ptrs
from .foo import hello
from .foo import parameter_overloads,MyInt

fn check_dict():
    try:
        let dictionary = Python.dict()
        dictionary["fruit"] = "apple"
        dictionary["starch"] = "potato"

        let keys: PythonObject = ["fruit", "starch", "protein"]
        let N: Int = keys.__len__().__index__()
        print(N, "items")

        for i in range(N):
            if Python.is_type(dictionary.get(keys[i]), Python.none()):
                print(keys[i], "is not in dictionary")
            else:
                print(keys[i], "is included")
    except:
        pass


fn run_py():
    try:
        let up: PythonObject = Python.import_module("utils")
        let np = Python.import_module("numpy")
        var hr: PythonObject = None
        var ar: PythonObject = None
        _ = hello()
        _ = up.hello()
        hr = up.my_algorithm(2, 3)
        print("hr:", hr)
        ar = np.arange(30).reshape(5, 6)
        print("ar:", ar)
        print("ar.share:", ar.shape)
    except:
        pass


fn run():
    print("---------- run in main start ----------")
    print("---------- work_with_unique_ptrs:")
    work_with_unique_ptrs()
    print("---------- check_dict:")
    check_dict()
    print("---------- run_py:")
    run_py()
    parameter_overloads[1, 2, MyInt(3)]()
    print("---------- run in main end ------------")
